/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Tuan Long
 */
@Entity
@Table(name = "PictureLibrary")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PictureLibrary.findAll", query = "SELECT p FROM PictureLibrary p"),
    @NamedQuery(name = "PictureLibrary.findById", query = "SELECT p FROM PictureLibrary p WHERE p.id = :id"),
    @NamedQuery(name = "PictureLibrary.findByPictureURL", query = "SELECT p FROM PictureLibrary p WHERE p.pictureURL = :pictureURL"),
    @NamedQuery(name = "PictureLibrary.findByAlbum", query = "SELECT p FROM PictureLibrary p WHERE p.album = :album")})
public class PictureLibrary implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "Id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2147483647)
    @Column(name = "PictureURL")
    private String pictureURL;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "Album")
    private String album;
    @JoinColumn(name = "Username", referencedColumnName = "Username")
    @ManyToOne(optional = false)
    private Employee username;

    public PictureLibrary() {
    }

    public PictureLibrary(Integer id) {
        this.id = id;
    }

    public PictureLibrary(Integer id, String pictureURL, String album) {
        this.id = id;
        this.pictureURL = pictureURL;
        this.album = album;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPictureURL() {
        return pictureURL;
    }

    public void setPictureURL(String pictureURL) {
        this.pictureURL = pictureURL;
    }

    public String getAlbum() {
        return album;
    }

    public void setAlbum(String album) {
        this.album = album;
    }

    public Employee getUsername() {
        return username;
    }

    public void setUsername(Employee username) {
        this.username = username;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PictureLibrary)) {
            return false;
        }
        PictureLibrary other = (PictureLibrary) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.PictureLibrary[ id=" + id + " ]";
    }
    
}
